// store/index.js
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin: false,
    userInfo: {
      username: ''
    }
  },
  mutations: {
    login(state, username) {
      state.isLogin = true
      state.userInfo.username = username
    },
    logout(state) {
      state.isLogin = false
      state.userInfo.username = ''
    }
  }
})